home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 3 / CD ACTUAL 3.iso / linux / incoming / jstools-.6v3 / jstools- / jstools-tk3.6v3.0 / lib / jdoc / jfindpanel.tcl.jdoc < prev    next >
Encoding:
Text File  |  1995-03-14  |  8.0 KB  |  91 lines

  1. {jfindpanel.tcl
  2.  
  3. Introduction
  4. The jfindpanel.tcl library is distributed as part of the jstools package.  It consists of procedures to implement a search¡and¡replace dialogue box for text widgets.  The central procedure is j:find, which creates the dialogue box and calls the other procedures as necessary.
  5.  
  6. Currently, these procedures all communicate via global variables with the contents of the j:find fields and checkboxes.  I hope to change this in the future so that they will take arguments, to make them more useful independently of each other.  This means that you shouldn't count on the calling conventions for these procedures staying constant, except for j:find itself.
  7.  
  8. This document describes jfindpanel.tcl version 3.6/3.0.
  9.  
  10. Usage
  11. Accessing the Library
  12. In order to use the jfindpanel.tcl library, it (and any other libraries it depends on) must be in your Tcl auto_path, described in tclvars(n).  Information about how to arrange that, and other conventions common to the jstools libraries, is in the Usage section of The jstools Libraries.
  13.  
  14. Credits and Copyright
  15. Author
  16. Jay Sekora 
  17. js@bu.edu
  18. http://shore.net/~js/
  19.  
  20. Copyright
  21. The library is copyright ⌐ 1992-1994 by Jay Sekora, but may be freely copied and modified for non¡commercial purposes.  (Please contact me if you want to use it for a commercial purpose, this may be OK under some circumstances.)
  22.  
  23. Overview
  24. Procedures
  25. j:find - search¡and¡replace panel
  26. j:find:again - search again for same string
  27. j:find:find_string - find and select string in text widget
  28. j:find:replace - replace selection in text widget with string
  29. j:find:replace_all - change all occurences of string in text widget
  30.  
  31. j:find
  32. Usage
  33.     j:find [options] w
  34. Argument
  35.     w is the text widget to search in
  36. Option
  37.     -replace bool  (default 1)
  38.  
  39. Description
  40. This procedure brings up a find panel that allows the user to search for text (and, optionally, replace it) in a text widget, w.  By default, i.e. if bool is not false, the panel has two entry widgets labelled `Search for:' and `Replace with:', three checkbuttons labelled `Backwards', `Case¡sensitive', and `Regex', and four buttons labelled `Search', `Replace', `Replace All', and `Cancel'.  (The default button is `Search'.)
  41.  
  42. Complete usage documentation for the Find Panel itself (as opposed to the library) is available in The jstools Find Panel.
  43.  
  44. Unless -replace 0 has been specified, the user will be able to replace the found string by typing a replacement in the `Replace with:' field and clicking on the `Replace' or `Replace All' button.  You will want to specify -replace 0 when using the find panel with read¡only (-state disabled) text widgets.  If you don't do this, the user will be able to hang your application by trying to replace text in a disabled widget.  (This should probably be considered a bug.)
  45.  
  46. Note that although the find panel is non¡modal, an application can only have one find panel displayed at a time.
  47.  
  48. j:find:again
  49. Usage
  50.     j:find:again w
  51. Argument
  52.     w is the text widget to search in
  53.  
  54. Description
  55. This procedure is used to search for the next occurrence of a string previously entered into a find panel.  It has the same effect as clicking on the `Search' button in the find panel, but it doesn't require the find panel to be displayed.  It's convenient as a keyboard shortcut.
  56.  
  57. If no value has been entered into a find panel when this procedure is invoked, it will simply call j:find to display a find panel.
  58.  
  59. j:find:find_pattern
  60. j:find:replace
  61. j:find:replace_regexp
  62. j:find:replace_all
  63. These procedures are used by the Find Panel.  Their communication conventions are not very mature at this point, so you shouldn't rely on them yet.  They (or something like them) will become public procedures in a future version of the library.
  64.  
  65. Evolution
  66. Feel free to report bugs (and feature requests) to me, <js@bu.edu>, and I will try to deal with them.  Also, feel free to fix bugs or add features on your own and let me know how you did it.
  67.  
  68. Bugs and Limitations
  69. * There's no way to do a backwards regular¡expression search.
  70.  
  71. * Searches are done by making copies of large parts of the text in a widget, so they're extremely wasteful of memory.
  72.  
  73. * The replacement string is always inserted literally; there should be a way to refer to submatches in a regular¡expression search.
  74.  
  75. Changes Since Version 3.6/2.0
  76. The ability to use regular expressions is new.
  77.  
  78. Changes from earlier versions
  79. These procedures used to be in a file called jlibrary.tcl.  Starting with version 3.6/2.0, they're in their own independent library.
  80.  
  81. Future Directions
  82. * Under Tk 4.0, searching should use the text widget's search subcommand; this should make it much more efficient.
  83.  
  84. * The procedures that actually do the searches should be public, and they should take options rather than looking at global variables to decide what kind of search to perform
  85.  
  86. * Searches should (perhaps optionally) wrap around.
  87.  
  88. * You should be able to use more than one Find Panel in an application.  The name of a Find Panel should be based on the name of the text widget it searches in.  (Perhaps it should be a child, so it'll automatically be destroyed when the text widget is.)
  89.  
  90. * You should be able to provide a window name for the find panel.  If the window doesn't exist, it should be created as a new toplevel; if it does exist, the new find panel should be packed into it (and the `Cancel' button shouldn't be displayed).  That would let people created find panels attached to text windows, which might be more intuitive for multi¡window documents.
  91. } {{{display:background:red {27.0 30.0}} {display:foreground:gold {27.0 30.0}} {jdoc:xref:link {4.57 4.64 12.215 12.236 12.244 12.261 12.265 12.286 25.0 25.6 26.0 26.12 42.99 42.121}} {jdoc:xref:manpage {12.131 12.138}} {jdoc:anchor:anchorname {3.0 4.0 10.0 11.0 14.0 15.0 23.0 24.0 31.0 32.0 48.0 49.0 65.0 66.0}} {richtext:font:roman {2.0 3.0 4.0 4.4 4.18 4.57 4.64 4.192 4.198 6.90 6.96 6.359 6.365 8.24 8.38 10.0 12.0 12.20 12.34 12.107 12.116 12.131 12.138 12.219 12.226 12.248 12.253 12.265 12.286 14.0 16.0 17.0 17.9 18.0 18.21 20.0 21.0 23.0 25.6 26.0 26.12 27.0 27.18 28.0 28.14 29.0 29.18 31.0 33.8 33.9 33.16 33.17 33.19 34.0 35.0 35.1 35.2 36.0 37.16 37.25 37.26 39.0 40.0 40.126 40.127 40.150 40.154 40.417 40.418 40.424 40.425 42.99 42.121 44.7 44.17 44.222 44.232 44.275 44.290 48.0 50.15 51.0 52.0 52.1 52.2 54.0 55.0 57.99 57.105 59.0 59.19 60.0 60.14 61.0 61.21 62.0 62.18 65.0 66.0 66.55 66.66 68.0 69.0 75.0 76.0 78.0 78.29 79.45 79.57 81.0 81.17 82.55 82.61 91.0}} {richtext:font:italic {33.9 33.16 33.18 33.19 35.1 35.2 37.10 37.14 40.126 40.127 40.150 40.154 40.417 40.418 40.424 40.425 50.14 50.15 52.1 52.2}} {richtext:font:bold {4.4 4.18 4.57 4.64 8.24 8.38 12.20 12.34 12.219 12.226 79.45 79.57}} {richtext:font:bolditalic {12.248 12.253 12.265 12.286 42.99 42.121}} {richtext:font:typewriter {4.192 4.198 6.90 6.96 6.359 6.365 12.107 12.116 12.131 12.138 17.0 17.9 18.0 18.21 25.0 25.6 26.0 26.12 27.0 27.18 28.0 28.14 29.0 29.18 33.0 33.8 33.17 33.18 37.0 37.10 37.14 37.16 37.25 37.26 44.7 44.17 44.222 44.232 44.275 44.290 50.0 50.14 57.99 57.105 66.55 66.66 82.55 82.61}} {richtext:font:heading0 {1.0 2.0}} {richtext:font:heading1 {3.0 4.0 10.0 11.0 14.0 15.0 23.0 24.0 31.0 32.0 48.0 49.0 59.0 59.19 60.0 60.14 61.0 61.21 62.0 62.18 65.0 66.0}} {richtext:font:heading2 {11.0 12.0 15.0 16.0 20.0 21.0 24.0 25.0 32.0 33.0 34.0 35.0 36.0 37.0 39.0 40.0 49.0 50.0 51.0 52.0 54.0 55.0 68.0 69.0 75.0 76.0 78.0 78.29 81.0 81.17}} {jdoc:link:jstools.jdoc {4.57 4.64}} {jdoc:manpage:tclvars {12.131 12.138}} {jdoc:link:jslibraries.tcl {12.215 12.236}} {jdoc:link:jslibraries.jdoc#Usage {12.244 12.261}} {jdoc:link:jslibraries.jdoc {12.265 12.286}} {{} {14.0 22.0 24.0 24.10 80.0 81.0}} {jdoc:link:panels/findpanel.jdoc {42.99 42.121}} {jdoc:anchorname:Introduction {3.0 4.0}} {jdoc:anchorname:Usage {10.0 11.0}} {jdoc:anchorname:Credits_and_Copyright {14.0 15.0}} {jdoc:anchorname:Overview {23.0 24.0}} {jdoc:anchorname:j:find {31.0 32.0}} {jdoc:anchorname:j:find:again {48.0 49.0}} {jdoc:anchorname:Evolution {65.0 66.0}} {jdoc:link:#j:find {25.0 25.6}} {jdoc:link:j:find:again.jdoc {26.0 26.12}}} {{abbrevstart 74.0} {richptr 62.0} {abbrevend 74.0} {insert 8.54} {anchor 8.54} {current 1.14}}}